<h1>CALCULATOR</h1>
<form action="calculator.php" method="GET">
<input type="text" name="expression">
<input type="submit" value="Calculate">
</form>
<?php
error_reporting(0);
if(!empty($_GET)) {
	eval("\$result = ".$_GET['expression'].";");
	if(!preg_match("#^[+-]?[0-9]+(.[0-9]+)?([+\-*/][\s]*[+-]?[0-9]+(.[0-9]+)?)*$#",$_GET['expression'])
	|| !is_numeric($result) )
		echo("Invalid input!");
	else 
		echo("Result = ".$result);
		
}
?>